# -*- coding: utf-8 -*-
"""
Created on Fri Nov  9 00:28:14 2018

@author: Administrator
"""

class SeqStack:
    """auto growth seq stack
    """
    def __init__(self):
        self.elements = []
        self.length = 0
    
    def is_empty(self):
        if self.length == 0:
            return True
        return False
    
    def push(self, element):
        """element is pushed into the stack
        """
        self.elements.append(element)
        self.length += 1
        
    def pop(self):
        """element is poped from the stack
        """
        if self.length == 0:
            raise ValueError("stack empty!")
        result = self.elements.pop()
        self.length -= 1
        return result
    
    def top(self):
        """look the top element of the stack
        """
        return self.elements[-1] # -1 : return the end element of the list
    
    def depth(self):
        return self.length
    
    def print_all(self):
        return self.elements